package hanqi.mangement.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import hanqi.mangement.entity.gradebro;
import hanqi.mangement.entity.student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface studentMapper extends BaseMapper<student> {
    @Select("SELECT g.id, s.name AS studentname, c.title AS coursename, g.score " +
            "FROM grades g " +
            "JOIN student s ON g.student_id = s.id " +
            "JOIN course c ON g.course_id = c.id " +
            "WHERE g.student_id = #{studentId}")
    List<gradebro> findGradesByStudentId(@Param("studentId")int studentId);
}
